package com.ll.gulimall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ll.common.utils.PageUtils;
import com.ll.gulimall.order.entity.OrderEntity;
import com.ll.gulimall.order.vo.*;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author liliang
 * @email liliang@gmail.com
 * @date 2020-07-31 00:52:17
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    OrderSubmitResponseVo submitOrder(OrderSubmitVo orderSubmitVo);

    /**
     * 关闭订单
     * @param message
     * @param orderEntity
     * @param channel
     */
    void closeOrder(Message message, OrderEntity orderEntity, Channel channel);

    /**
     * 根据订单号构建支付对象
     * @param orderSn
     * @return
     */
    PayVo getPayOrder(String orderSn);

    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 支付成功 修改订单 添加流水
     * @param payAsyncVo
     * @return 返回success 成功 其他任意文字失败
     */
    String paySuccess(PayAsyncVo payAsyncVo);
}

